package com.xuecheng.search.controller;

import com.xuecheng.api.search.EsTeachplanMediaControllerApi;
import com.xuecheng.framework.domain.search.TeachplanMediaSearch;
import com.xuecheng.framework.model.response.QueryResponseResult;
import com.xuecheng.search.service.EsTeachplanMediaService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/teachplan/media")
public class EsTeachplanMediaController implements EsTeachplanMediaControllerApi {
    @Resource
    private EsTeachplanMediaService esTeachplanMediaService;
    /**
     * 根据课程计划的节点id查询课程计划节点对应的视频地址
     *
     * @param teachplanId 课程计划id
     * @return ES里面记录的课程计划和视频url
     */
    @Override
    @GetMapping("/{teachplanId}")
    public QueryResponseResult<TeachplanMediaSearch> getTeachplanMediaByTeachplanId(@PathVariable("teachplanId") String[] teachplanId) {
        return esTeachplanMediaService.getTeachplanMediaByTeachplanId(teachplanId);
    }
}
